
//================================================================================//
// Stata Replication code														  //
//																				  //
// Article: Constitutional Renewals: The Lineage of Democratizing Constitutions   //
// Authors: Gabriel Negretto & Mariano Sánchez-Talanquer                          //
// Journal: Public Choice														  //
// February 2025																  //
//================================================================================//


**Load data
use ConstRenewals_data.dta


*------------------------------------------------------------------------------------------------------------------------------------------------------*
*------------------------------------------------------------------------------------------------------------------------------------------------------*
**# Preamble - define vars

*Define outcomes, constitutional design
global outcomes exconstformalstd legpowerstd civlibformalstd participformalstd

*Define outcomes, constitutional enforcement
global outcomes_enf exconststd v2x_horaccstd v2x_civlibstd directdemstd

*Key independent variables
global treat_vars pluralapp consult voting

*Control variables for design outcomes
global controls democracyage loggdppc logpop ib0.regtypebefore##i.after ib1.wave i.relativeyear 

*Controls for constitutional enforcement
global controls_enf competitionstd v2xcs_ccsi democracyage loggdppc logpop ib0.regtypebefore##i.after ib1.wave i.relativeyear 

*Macro for all outcomes
global alloutcomes exconstformalstd legpowerstd civlibformalstd participformalstd exconststd v2x_horaccstd v2x_civlibstd directdemstd


*------------------------------------------------------------------------------------------------------------------------------------------------------*
*------------------------------------------------------------------------------------------------------------------------------------------------------*
**# Tables 1 and 2. Constitutional design outcomes

*Declare structure
xtset constitutionid relativeyear

*Loop for constitutional design models
foreach outcome in $outcomes {
    foreach var in $treat_vars {
        xtreg `outcome' i.`var'##i.after $controls, fe vce(cluster constitutionid)
    }
}


*------------------------------------------------------------------------------------------------------------------------------------------------------*
*------------------------------------------------------------------------------------------------------------------------------------------------------*
**# Tables 3 and 4. Constitutional enforcement outcomes 

*Declare structure
xtset constitutionid relativeyear

*Loop for constitutional enforcement models
foreach outcome in $outcomes_enf {
    foreach var in $treat_vars {
        xtreg `outcome' i.`var'##i.after $controls_enf, fe vce(cluster constitutionid)        
    }
}


*-------------------------------------------------------------------------------------------------------------------------------------------------------*
*-------------------------------------------------------------------------------------------------------------------------------------------------------*
*-------------------------------------------------------------------------------------------------------------------------------------------------------*
*Online supplementary materials.

**# Table A3. Groups by features of constitution-making
/*
(Dataset includes indicator vars identifying each group) 
Group	Plural approval		Citizen consultation	Citizen voting		Number of constitution-making processes
----------------------------------------------------------------------------------------------------------------
1				No					No					No								24
2				No					Yes					No								12
3				No					No					Yes								14
4				No					Yes					Yes								7
5				Yes					No					No								29
6				Yes					Yes					No								14
7				Yes					No					Yes								16
8				Yes					Yes					Yes								12
----------------------------------------------------------------------------------------------------------------
Total																				    128
*/


*-------------------------------------------------------------------------------------------------------------------------------------------------------*
*-------------------------------------------------------------------------------------------------------------------------------------------------------*
**# Table A4. DiD estimates of PLURAL APPROVAL's effect across estimation subsamples 
*Treatment: plural approval. Time window: t-10 to t+10. Two-way fixed effects (constitution process & year-in-process)

*Full sample (Table A4, column 1)
foreach outcome in $alloutcomes {
     xtreg `outcome' i.pluralapp##i.after i.relativeyear, fe vce(cluster constitutionid)
}

*Group 1 vs. 5 (Table A4, column 2)
foreach outcome in $alloutcomes {
     xtreg `outcome' i.plural_nodelib_novoting##i.after i.relativeyear if (plural_nodelib_novoting == 1 | noplural_nodelib_novoting == 1), fe vce(cluster constitutionid) baselevels
}

*Group 2 vs. 6 (Table A4, column 3)
foreach outcome in $alloutcomes { 
     xtreg `outcome' i.plural_yesdelib_novoting##i.after i.relativeyear if (plural_yesdelib_novoting == 1 | noplural_yesdelib_novoting == 1), fe vce(cluster constitutionid) baselevels
}
 
*Groups 3 vs. 7 (Table A4, column 4)
foreach outcome in $alloutcomes {
     xtreg `outcome' i.plural_nodelib_yesvoting##i.after i.relativeyear if (plural_nodelib_yesvoting == 1 | noplural_nodelib_yesvoting == 1), fe vce(cluster constitutionid) baselevels
}
 
*Groups 4 vs. 8 (Table A4, column 4)
foreach outcome in $alloutcomes {
     xtreg `outcome' i.plural_yesdelib_yesvoting##i.after i.relativeyear if (plural_yesdelib_yesvoting == 1 | noplural_yesdelib_yesvoting == 1), fe vce(cluster constitutionid) baselevels
}

 
*--------------------------------------------------------------------------------------------------------------------------------*
*--------------------------------------------------------------------------------------------------------------------------------*
**# Table A5. DiD estimates of CITIZEN CONSULTATION's effect across estimation subsamples 

*Full sample (Table A5, column 1)
foreach outcome in $alloutcomes {
      xtreg `outcome' i.consult##i.after i.relativeyear, fe vce(cluster constitutionid)
}

*Groups 1 vs. 2 (Table A5, column 2)
foreach outcome in $alloutcomes {
     xtreg `outcome' i.noplural_yesdelib_novoting##i.after i.relativeyear if (noplural_yesdelib_novoting == 1 | noplural_nodelib_novoting == 1), fe vce(cluster constitutionid) baselevels
}

*Groups 3 vs. 4 (Table A5, column 3)
 foreach outcome in $alloutcomes {
     xtreg `outcome' i.noplural_yesdelib_yesvoting##i.after i.relativeyear if (noplural_yesdelib_yesvoting == 1 | noplural_nodelib_yesvoting == 1), fe vce(cluster constitutionid) baselevels
}

*Groups 5 vs. 6 (Table A5, column 4)
 foreach outcome in $alloutcomes {
     xtreg `outcome' i.plural_yesdelib_novoting##i.after i.relativeyear if (plural_yesdelib_novoting == 1 | plural_nodelib_novoting == 1), fe vce(cluster constitutionid) baselevels
}
 
*Groups 7 vs. 8 (Table A5, column 5)
  foreach outcome in $alloutcomes {
     xtreg `outcome' i.plural_yesdelib_yesvoting##i.after i.relativeyear if (plural_yesdelib_yesvoting == 1 | plural_nodelib_yesvoting == 1), fe vce(cluster constitutionid) baselevels
}
 

*--------------------------------------------------------------------------------------------------------------------------------* 
*--------------------------------------------------------------------------------------------------------------------------------*
**# Table A6. DiD estimates of CITIZEN VOTING's effect across estimation subsamples 
 
*Full sample (Table A6, column 1)
foreach outcome in $alloutcomes {
      xtreg `outcome' i.voting##i.after i.relativeyear, fe vce(cluster constitutionid)
}

*1 vs 3 (Table A6, column 2)
foreach outcome in $alloutcomes {
     xtreg `outcome' i.noplural_nodelib_yesvoting##i.after i.relativeyear if (noplural_nodelib_yesvoting == 1 | noplural_nodelib_novoting == 1), fe vce(cluster constitutionid) baselevels
}

*2 vs 4 (Table A6, column 3)
foreach outcome in $alloutcomes {
     xtreg `outcome' i.noplural_yesdelib_yesvoting##i.after i.relativeyear if (noplural_yesdelib_yesvoting == 1 | noplural_yesdelib_novoting == 1), fe vce(cluster constitutionid) baselevels
}

*5 vs 7 (Table A6, column 4)
foreach outcome in $alloutcomes {
     xtreg `outcome' i.plural_nodelib_yesvoting##i.after i.relativeyear if (plural_nodelib_yesvoting == 1 | plural_nodelib_novoting == 1), fe vce(cluster constitutionid) baselevels
}

*6 vs 8 (Table A6, column 5)
foreach outcome in $alloutcomes {
     xtreg `outcome' i.plural_yesdelib_yesvoting##i.after i.relativeyear if (plural_yesdelib_yesvoting == 1 | plural_yesdelib_novoting == 1), fe vce(cluster constitutionid) baselevels
}



*--------------------------------------------------------------------------------------------------------------------------------*
*--------------------------------------------------------------------------------------------------------------------------------*
**# Table A7. DiD estimates of joint effect of plural approval, citizen consultation, and citizen voting

*1 vs 8:
foreach outcome in $alloutcomes {
     xtreg `outcome' i.plural_yesdelib_yesvoting##i.after i.relativeyear if (plural_yesdelib_yesvoting == 1 | noplural_nodelib_novoting == 1), fe vce(cluster constitutionid) baselevels
}



*--------------------------------------------------------------------------------------------------------------------------------*
*--------------------------------------------------------------------------------------------------------------------------------*
**# Table A8.Constitution-making and counter-majoritarian institutions: formal and de facto power of upper houses
foreach var in $treat_vars {
    xtreg upperblockstd i.`var'##i.after $controls, fe vce(cluster constitutionid) 
}
	
foreach var in $treat_vars {
    xtreg upperlegislatesstd i.`var'##i.after $controls_enf, fe vce(cluster constitutionid) 
}



*------------------------------------------------------------------------------------------------------------------------------------------------*
*------------------------------------------------------------------------------------------------------------------------------------------------*
*------------------------------------------------------------------------------------------------------------------------------------------------*
**# Event studies preamble (data prep)

***Controls for constitutional design event studies
global controls_evst_design democracyage loggdppc logpop ib0.regtypebefore##i.after

***Controls for constitutional enforcement event studies
global controls_evst_enf competitionstd v2xcs_ccsi democracyage loggdppc logpop ib0.regtypebefore##i.after

foreach treat in $treat_vars {
	*Code cohort variable based on plural approval treatment onset 
	gen year_`treat' = year if constyear == 1 & `treat' == 1
	bysort constitutionid: egen year`treat'const = min(year_`treat')
	
	*Code relative time variables (rel to constitutional enactment & to process initiation)
	gen relyear_reltoconst_`treat' = year-year`treat'const
	gen year_processbegins_`treat' = year if constmakingbegins == 1 & `treat' == 1
	bysort constitutionid: egen yearprocessbegins_`treat' = min(year_processbegins_`treat')
	gen relyear_reltoprocess_`treat' = year-yearprocessbegins_`treat'

	*Define control cohort processes (never treated)
    gen never`treat'const = (year`treat'const == .)
	
	*Generate leads (-10 to -2)
	forvalues k = 10(-1)2 {
       gen `treat'_`k' = relyear_reltoprocess_`treat' == -`k'
	}
   
   *Generate lags (0 to 10)
   forvalues k = 0/10 {
        gen `treat'`k' = relyear_reltoconst_`treat' == `k'
	}

	* Set missing values for years between beginning and end of the process
    foreach var of varlist `treat'_* `treat'* {
        replace `var' = . if (constmakingbegins == 1 & constyear != 1) | (after == 1 & relativeyear == . & constyear != 1)
    }
}


*--------------------------------------------------------------------------------------------------------------------------------*
*-----------------------------------------------------------------------------------------------------------------------------------------------*
**# Event studies: Effects of plural approval, citizen consultation, and citizen voting 
** Looping over treatment variables

foreach treat in $treat_vars{
	
	*Event studies for constitutional design outcomes
	foreach outcome in $outcomes {
		eventstudyinteract `outcome' `treat'_* `treat'0-`treat'10, cohort(year`treat'const) control_cohort(never`treat'const) absorb(i.constitutionid i.year) covariates($controls_evst_design) vce(cluster constitutionid)

	matrix b`outcome' = e(b_iw)
	matrix V`outcome' = e(V_iw)


	*Draw event study plot
	event_plot b`outcome'#V`outcome', stub_lag(`treat'#) stub_lead(`treat'_#) plottype(connected) together ciplottype(rspike) lag_opt(msymbol(circle) mcolor(white) mlcolor(gs3) msize(small) lcolor(gs3)) lag_ci_opt(color(gs3)) graph_opt(title("Effects of `treat' on Constitutional Design", size(medium)) xtitle("Years around constitution-making process") ytitle("Estimate") yline(0, lcolor(gray) lpattern(shortdash) lwidth(thin)) ylabel(,nogrid) xlabel(,nogrid) xline(0, lcolor(gray) lpattern(shortdash) lwidth(thin)) xlabel(-10(2)10)) 

	graph save "Graph" "Eventstudyplot_`treat'_`outcome'.gph", replace
}

	* Combine graphs for constitutional design outcomes
	graph combine "Eventstudyplot_`treat'_exconstformalstd.gph" "Eventstudyplot_`treat'_legpowerstd.gph" "Eventstudyplot_`treat'_civlibformalstd.gph" "Eventstudyplot_`treat'_participformalstd.gph", saving(combined_evstplot_`treat'_design, replace) 
	

	*Event studies for constitutional enforcement outcomes
	foreach outcome in $outcomes_enf {
	eventstudyinteract `outcome' `treat'_* `treat'0-`treat'10, cohort(year`treat'const) control_cohort(never`treat'const) absorb(i.constitutionid i.year) covariates ($controls_evst_enf) vce(cluster constitutionid)

	matrix b`outcome' = e(b_iw)
	matrix V`outcome' = e(V_iw)

	*Draw event study plot
	event_plot b`outcome'#V`outcome', stub_lag(`treat'#) stub_lead(`treat'_#) plottype(connected) together ciplottype(rspike) lag_opt(msymbol(circle) mcolor(white) mlcolor(gs3) msize(small) lcolor(gs3)) lag_ci_opt(color(gs3)) graph_opt(title("Effects of `treat' on Constitutional Enforcement", size(medium)) xtitle("Years around constitution-making process") ytitle("Estimate") yline(0, lcolor(gray) lpattern(shortdash) lwidth(thin)) ylabel(,nogrid) xlabel(,nogrid) xline(0, lcolor(gray) lpattern(shortdash) lwidth(thin)) xlabel(-10(2)10)) 

	graph save "Graph" "Eventstudyplot_`treat'_`outcome'.gph", replace
}

	* Combine graphs for constitutional design outcomes
	graph combine "Eventstudyplot_`treat'_exconststd.gph" "Eventstudyplot_`treat'_v2x_horaccstd.gph" "Eventstudyplot_`treat'_v2x_civlibstd.gph" "Eventstudyplot_`treat'_directdemstd.gph", saving(combined_evstplot_`treat'_enforcement, replace) 
}
   

